[#ftl]
[#include "commonDef.ftl" /]
${pack_own}

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
${base_pack}.common.core.domain.R;
${base_pack}.common.core.web.domain.AjaxResult;
${base_pack}.common.core.web.page.TableDataInfo;
${base_pack}.common.core.constant.Constants;
${pack_feign}
[#-- 方法对象引入 --]
${import_method_class2}
${import_class}

/**
 * ${data_main.moduleKeyName}
 * @author ${author_str!"zhouliang"}
 * @date ${date_str}
 */
public class ${name_own} implements FallbackFactory<${name_feign}> {
    private static final Logger log = LoggerFactory.getLogger(${name_own}.class);

    @Override
    public ${name_feign} create(Throwable throwable)
    {
        return new ${name_feign}()
        {
            [#if data_method??]
            [#list data_method as mdx]
            [#if mdx.needFlag == '1']
                /** ${mdx.methodKeyName} */
            [#if checkTypeFunc(mdx.methodOprType,["getdetail","getlist"]) ]
                @Override
                public R<${mdx.tags['name_res']}> ${ControllerMethodName(data_main,mdx)}(${mdx.tags['name_req']} reqInfo) throws Exception{
                    String errormsg="${ControllerMethodTitle(data_main,mdx)},调用失败:"+throwable.getMessage();
                    log.error(errormsg);
                    return R.fail(errormsg);
                }
            [#elseif checkTypeFunc(mdx.methodOprType,["getpage"]) ]
                @Override
                public TableDataInfo<${mdx.tags['name_res']}> ${ControllerMethodName(data_main,mdx)}(${mdx.tags['name_req']} reqInfo) throws Exception{
                    String errormsg="${ControllerMethodTitle(data_main,mdx)},调用失败:"+throwable.getMessage();
                    log.error(errormsg);
                    return new TableDataInfo(errormsg);
                }
            [#else]
                @Override
                public R<${mdx.tags['name_res']}> ${ControllerMethodName(data_main,mdx)}(${mdx.tags['name_req']} reqInfo) throws Exception{
                    String errormsg="${ControllerMethodTitle(data_main,mdx)},调用失败:"+throwable.getMessage();
                    log.error(errormsg);
                    return R.fail(errormsg);
                }
            [/#if]
            [/#if]
            
            [/#list]
            [/#if]
        };
    }
}
